package com.tbh.ioc.extend;

import com.tbh.ioc.bean.HelloWorld;
import com.tbh.ioc.bean.HelloWorldSon;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ExtendsMain {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
        HelloWorld helloWorld = (HelloWorld) context.getBean("helloWorld");
        String message = helloWorld.getMessage();
        System.out.println(message);


        HelloWorldSon helloWorldSon = (HelloWorldSon) context.getBean("helloWorldSon");
        String overrideMessage = helloWorldSon.getMessage();
        String messageSon = helloWorldSon.getMessageSon();
        System.out.println(overrideMessage);
        System.out.println(messageSon);

    }
}
